<?php

namespace app\admin\validate\company;

use ShidianUtil\Thinkphp\Validate\BaseValidate;

/**
 * Class Company
 * @package app\admin\validate\company
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037623
 * @see \app\admin\controller\company\Company
 */
class Company extends BaseValidate
{

    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'isId',
        'username' => 'scalar|max:32',
        'password' => 'scalar|max:32',
        'salt' => 'scalar|max:6',
        'isAdmin' => 'integer|egt:0|max:3',
        'name' => 'scalar|max:12',
        'mobile' => 'scalar|max:16',
        'email' => 'scalar|max:32',
        'roleId' => 'integer|egt:0|max:10',
        'roleType' => 'scalar|max:16',
        'status' => 'integer|egt:0|max:3',
        'secretKey' => 'scalar|max:32',
        'desc' => 'scalar|max:255',
        'updated' => 'integer|egt:0|max:11',
        'created' => 'integer|egt:0|max:11',
        'deleted' => 'integer|egt:0|max:11',
        'systemId' => 'integer|egt:0|max:1',
        'departmentId' => 'integer|egt:0|max:11',
        'token' => 'scalar|max:64',
        'page' => 'integer|egt:0|max:11',
        'page_size' => 'integer|egt:0|max:11',
    ];

    protected $field = [
        'id' => 'id',
        'username' => '登录账号',
        'password' => '登录密码',
        'name' => '公司名称',
        'desc' => '公司描述',
        'page' => '分页页数',
        'page_size' => '分页大小',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => '缺少:attribute',
        'id.isId' => '请设置正确的:attribute',
        'username.require' => '请输入:attribute',
        'username.scalar' => ':attribute应该是字符串',
        'username.max' => ':attribute长度不能超过:rule位',
        'password.require' => '请输入:attribute',
        'password.scalar' => ':attribute应该是字符串',
        'password.max' => ':attribute长度不能超过:rule位',
        'salt.require' => '请输入:attribute',
        'salt.scalar' => ':attribute应该是字符串',
        'salt.max' => ':attribute长度不能超过:rule位',
        'isAdmin.require' => '请输入:attribute',
        'isAdmin.integer' => ':attribute应该是整数',
        'isAdmin.egt' => ':attribute应该大于等于:rule',
        'isAdmin.max' => ':attribute长度不能超过:rule位',
        'name.require' => '请输入:attribute',
        'name.scalar' => ':attribute应该是字符串',
        'name.max' => ':attribute长度不能超过:rule位',
        'mobile.require' => '请输入:attribute',
        'mobile.scalar' => ':attribute应该是字符串',
        'mobile.max' => ':attribute长度不能超过:rule位',
        'email.require' => '请输入:attribute',
        'email.scalar' => ':attribute应该是字符串',
        'email.max' => ':attribute长度不能超过:rule位',
        'roleId.require' => '请输入:attribute',
        'roleId.integer' => ':attribute应该是整数',
        'roleId.egt' => ':attribute应该大于等于:rule',
        'roleId.max' => ':attribute长度不能超过:rule位',
        'roleType.require' => '请输入:attribute',
        'roleType.scalar' => ':attribute应该是字符串',
        'roleType.max' => ':attribute长度不能超过:rule位',
        'status.require' => '请输入:attribute',
        'status.integer' => ':attribute应该是整数',
        'status.egt' => ':attribute应该大于等于:rule',
        'status.max' => ':attribute长度不能超过:rule位',
        'secretKey.require' => '请输入:attribute',
        'secretKey.scalar' => ':attribute应该是字符串',
        'secretKey.max' => ':attribute长度不能超过:rule位',
        'desc.require' => '请输入:attribute',
        'desc.scalar' => ':attribute应该是字符串',
        'desc.max' => ':attribute长度不能超过:rule位',
        'updated.require' => '请输入:attribute',
        'updated.integer' => ':attribute应该是整数',
        'updated.egt' => ':attribute应该大于等于:rule',
        'updated.max' => ':attribute长度不能超过:rule位',
        'created.require' => '请输入:attribute',
        'created.integer' => ':attribute应该是整数',
        'created.egt' => ':attribute应该大于等于:rule',
        'created.max' => ':attribute长度不能超过:rule位',
        'deleted.require' => '请输入:attribute',
        'deleted.integer' => ':attribute应该是整数',
        'deleted.egt' => ':attribute应该大于等于:rule',
        'deleted.max' => ':attribute长度不能超过:rule位',
        'systemId.require' => '请输入:attribute',
        'systemId.integer' => ':attribute应该是整数',
        'systemId.egt' => ':attribute应该大于等于:rule',
        'systemId.max' => ':attribute长度不能超过:rule位',
        'departmentId.require' => '请输入:attribute',
        'departmentId.integer' => ':attribute应该是整数',
        'departmentId.egt' => ':attribute应该大于等于:rule',
        'departmentId.max' => ':attribute长度不能超过:rule位',
        'token.require' => '请输入:attribute',
        'token.scalar' => ':attribute应该是字符串',
        'token.max' => ':attribute长度不能超过:rule位',
        'page.require' => '请输入:attribute',
        'page.integer' => ':attribute应该是整数',
        'page.egt' => ':attribute应该大于等于:rule',
        'page.max' => ':attribute长度不能超过:rule位',
        'page_size.require' => '请输入:attribute',
        'page_size.integer' => ':attribute应该是整数',
        'page_size.egt' => ':attribute应该大于等于:rule',
        'page_size.max' => ':attribute长度不能超过:rule位',
    ];

    protected $scene = [
        'delete' => ['id' => 'require'],
        'index' => ['page', 'page_size'],
        'read' => ['id' => 'require'],
        'save' => [
            'username' => 'require',
            'password',
            'name' => 'require',
            'desc' => 'require',
        ],
    ];

}
